home *** CD-ROM | disk | FTP | other *** search
- Path: news.iag.net!news
- From: jatmon@iag.net (John R Buchan)
- Newsgroups: comp.lang.c,comp.os.msdos.programmer
- Subject: Re: tc++: vram 4 K segment warp-around ?
- Followup-To: comp.os.msdos.programmer
- Date: 15 Jan 1996 15:37:04 GMT
- Organization: Internet Access Group, Orlando, Florida
- Message-ID: <4ddsb0$1a1@news.iag.net>
- References: <30F6DE8A.20CD@ivic.qc.ca>
- NNTP-Posting-Host: pm1-orl26.iag.net
- X-Newsreader: WinVN 0.99.7
-
- In article <30F6DE8A.20CD@ivic.qc.ca>, jblanc@ivic.qc.ca says...
- >
- >/*
- > * help me! i'm using tc++ 3.0, and the following code outputs:
- > * p1 -> 3, p2 -> 3, p3 -> 3
- > * can someone explain me this 4 K warp-around?
- > *
- > * [ in fact, what i really intend is to use vram as a 1 K aligned
- > * buffer. if you have any other idea about how to achieve that (more
- > * portably, i hope), tell me! ]
- > */
- >
- >#include <dos.h>
- >
- >int main()
- >{
- >/* ptrs to video mem */
- > int far *p1 = (int far *) MK_FP(0xA000, 0x0000);
- > int far *p2 = (int far *) MK_FP(0xA000, 0x1000);
- > int far *p3 = (int far *) MK_FP(0xB000, 0x1000);
- >
- > *p1 = 1;
- > *p2 = 2;
- > *p3 = 3;
- >
- > printf("p1 -> %x, p2 -> %x, p3 -> %x\n", *p1, *p2, *p3);
- > return 0;
- >}
-
- Hmm... Maybe one of the bugs in TC 3.0? Using BC 3.1, I got the expected
- output. To verfiy the pointers I tried it again, adding the following printf
- (I had to switch to large memory model to get printf to print segment/offet
- notation)
-
- printf("%p\t%p\t%p\n", (void *)p1, (void *)p2, (void *)p3);
-
- The output, as expected, was:
-
- A000:0000 A000:1000 B000:1000
- p1 -> 1, p2 -> 2, p3 -> 3
-
- You might want to try this to verify that MK_FP is functioning properly
- in your version. You might also try verifying each assignment immediately
- after it's made. Beyond that you might poke aroung www.borland.com and see
- if they have any info on it.
-
- This is a compiler/system specific problem. So I an redirecting follow-ups
- to comp.os.msdos.programmer. You are much more likely to find people
- there, who are intimately familiar with DOS and TC 3.0.
-
- --
- John R Buchan -:|:- Looking for that elusive FAQ? ftp to:
- jatmon@mail.iag.net -:|:- rtfm.mit.edu /pub/usenet-by-group/....
-
-